package com.mutouren.common;

import java.util.concurrent.TimeUnit;

import com.google.common.cache.Cache;
import com.mutouren.common.cache.local.GuavaCacheUtils;
import com.mutouren.common.cache.local.GuavaCacheUtils.ExpireType;

public class App {

	public static void main(String[] args) throws InterruptedException {
		testOne();
	}
	
	private static void testOne() throws InterruptedException {
		Cache<String, String> cache = GuavaCacheUtils.createCache(5, TimeUnit.SECONDS, ExpireType.expireAfterAccess);
		cache.put("hello", "123456");
		
		for(int i = 0; i < 10; i++) {
			Thread.sleep(1000 * i);
			System.out.println(cache.getIfPresent("hello"));
		}
		
	}


}
